/* pfs04TimeUpdate.cpp
 *
 * --
 * Copyright (c) 2012, Christophe Huriaux
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * --
 */

#include <packet/pfs04TimeUpdate.h>
#include <wrapper/JavaStreamWrapper.h>

pfs04TimeUpdate::pfs04TimeUpdate()
    : McPacketFromServer(0x04), time(0)
{
}

unsigned int pfs04TimeUpdate::length()
{
    return 1 + 8;
}

int16_t pfs04TimeUpdate::setField(uint8_t field, void* value)
{

    switch (field)
    {
        case 0:
        default: return 8;
        case 1: time = JavaStreamWrapper::readLong(value); return -1;
    }
}

int64_t pfs04TimeUpdate::getTime()
{
    return time;
}


